package com.zzyl.mapper;


import com.github.pagehelper.Page;
import com.zzyl.dto.DeviceDto;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.entity.Device;
import com.zzyl.vo.DeviceDataGraphVo;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface DeviceMapper {

    @Select("select count(1) from device where nickname = #{nickname}")
    int queryNickName(String nickname);

    void addProduct(Device device);

    Page<List<DeviceVo>> pageQueryDevice(DevicePageQueryDto devicePageQueryDto);

    DeviceVo queryDeviceDetail(String iotId);

    void updateDevice( Device device);

    void deleteDevice(String iotId);

    List<DeviceDataGraphVo> queryDeviceDataListByDay(LocalDateTime start, LocalDateTime end, String iotId, String functionId);

    List<DeviceDataGraphVo> queryDeviceDataListByWeek(LocalDateTime start, LocalDateTime end, String iotId, String functionId);
}
